/*
 * Conversiones.java
 *
 * Created on 24 de enero de 2006, 05:30 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */


package com.ig.presentacion.modelos.desembolso.calculos;

public class Conversiones {

	/**
	 * @param tasa
	 * @param spread
	 * @return
	 * 
	 */
	public static double efectivoAnualATrimestreAnticipado(double tasa, double spread){
		//(1-((1+tasaReal)^(-1/4)))*4
		//(1-((1+B6)^(-1/B7)))*B7
		double a=1+(tasa+spread);
		System.out.println("--"+(tasa+spread));
		double b=-1.0/4;
		System.out.println("--"+(1-Math.pow(a,b))*(360/90));
		return (1-Math.pow(a,b))*(360/90);
	}
	
	/**
	 * @param tasa
	 * @param spread
	 * @return
	 */
	public static double efectivoAnualATrimestreVencido(double tasa, double spread){
		//(((1+tasaReal)^(1/4))-1)*4
		//(((1+E6)^(1/E7))-1)*E7
		double a=(1+(tasa+spread));
		double b=(1.0/(360/90));		
		return (Math.pow(a,b)-1)*(360/90);
	}
	
	/**
	 * @param tasa
	 * @param spread
	 * @return
	 */
	public static double efectivoAnualAPeriododAnticipado(double tasa, double spread,int periodo){
		//(1-((1+H6)^(-1/H7)))
		double a=(1+(tasa+spread));
		double b=(-1.0/(360/periodo));
		return (1-Math.pow(a,b));
	}
	/**
	 * @param tasa
	 * @param spread
	 * @return
	 * 
	 * 
	 */
	public static double efectivoAnualAPeriododVencido(double tasa, double spread,double periodo){
		//(((1+K6)^(1/K7))-1)
		double a=(1+(tasa+spread));
		double b=1.0/(360/periodo);
		return (Math.pow(a,b)-1);
	}
}